import request from "@/utils/request";

// 查询学科列表
export function listSubject(query) {
  return request({
    url: "/exam/subject/list",
    method: "get",
    params: query,
  });
}

// 查询学科详细
export function getSubject(subjectId) {
  return request({
    url: "/exam/subject/" + subjectId,
    method: "get",
  });
}
// 查询所属学科的试题
export function getQuestionBySubjectId(query) {
  return request({
    url: "/exam/subject/getQuestionBySubjectId",
    method: "get",
    params: query,
  });
}

// 新增学科
export function addSubject(data) {
  return request({
    url: "/exam/subject",
    method: "post",
    data: data,
  });
}

// 修改学科
export function updateSubject(data) {
  return request({
    url: "/exam/subject",
    method: "put",
    data: data,
  });
}

// 修改学科状态
export function updateSubjectStatus(subjectId, status) {
  return request({
    url: "/exam/subject/editStatus/" + subjectId + "/" + status,
    method: "post",
  });
}
// 删除学科
export function delSubject(ids) {
  return request({
    url: "/exam/subject/" + ids,
    method: "delete",
  });
}
